<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
// <!--        编写一个javascript对象  ES6 -->
        var user={
            name:"冲哥",
            age:22,
            sex:"男"
        };
        //将js对象转换为json对象
        var json=JSON.stringify(user);

        console.log(json);
    //    将JSON对象转换为JavaScript对象
         var ob= JSON.parse(json);
         console.log(ob);
    </script>
</head>
<body>

</body>
</html>